#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;

int main()
{
	string s;
	cin >> s;
	string ret;

	for(auto ch:s)
	{
		if(ret.size()&&ret.back() == ch)
		{
			ret.pop_back();
		}
		else
		{
			ret+=ch;
		}
	}
	if (ret.size() == 0)
	{
		cout << '0' << endl;
	}
	else
	{
		cout << ret << endl;
	}

	return 0;
}